CREATE TABLE jms_dm.dm_cusc_demand_delivery_waybill_detail_dt
(
    order_id                   varchar(100) comment '订单ID',
    waybill_id                 varchar(100) comment '运单号',
    order_source_code_order    varchar(100) comment '订单表-订单来源CODE',
    order_source_name_order    varchar(100) comment '订单表-订单来源名称',
    input_time                 varchar(100) comment '打标录入时间',
    arr_deliver_scantime       varchar(100) comment '第一次派件时间(到件时间)',
    sign_time                  varchar(100) comment '签收时间',
    deliver_usercode           varchar(100) comment '派件业务员code',
    deliver_username           varchar(100) comment '派件业务员name',
    deliver_scansite_code      varchar(100) comment '派件网点code',
    deliver_scansite_name      varchar(100) comment '派件网点name',
    deliver_fran_code          varchar(100) comment '派件网点加盟商code',
    deliver_fran_name          varchar(100) comment '派件网点加盟商name',
    deliver_agent_code         varchar(100) comment '派件网点代理区code',
    deliver_agent_name         varchar(100) comment '派件网点代理区name',
    first_network_network_code varchar(100) comment '始发网点网点code',
    first_network_network_name varchar(100) comment '始发网点网点name',
    first_network_fran_code    varchar(100) comment '始发网点加盟商code',
    first_network_fran_name    varchar(100) comment '始发网点加盟商name',
    first_network_agent_code   varchar(100) comment '始发网点代理区code',
    first_network_agent_name   varchar(100) comment '始发网点代理区name',
    is_reback                  varchar(100) comment '是否退回',
    customer_code              varchar(100) comment '客户编号CODE',
    customer_name              varchar(100) comment '客户编号名称',
    delivery_way               varchar(100) comment '派送方式',
    delivery_source            varchar(100) comment '派送来源',
    actual_delivery_way        varchar(100) comment '实际派送方式',
    sign_type                  varchar(100) comment '签收类型',
    is_performance             int comment '是否履约',
    date_time                  date comment '分区日期'
) ENGINE = OLAP DUPLICATE KEY(order_id,waybill_id)
COMMENT '按需配送明细'
PARTITION BY RANGE(sign_early_scantime)
(START ('2023-08-01') END ('2023-09-18') EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(date_time) BUCKETS 1
PROPERTIES (
'replication_num' = '3',
'dynamic_partition.enable' = 'true',
'dynamic_partition.time_unit' = 'DAY',
'dynamic_partition.time_zone' = 'Asia/Shanghai',
'dynamic_partition.start' = '-180',
'dynamic_partition.end' = '3',
'dynamic_partition.prefix' = 'p',
'dynamic_partition.buckets' = '1',
'in_memory' = 'false',
'storage_format' = 'V2'
);